Skip to content

feat(agent): Add job cleanup playbook task in update_agent#6554

Open
20vikash wants to merge 3 commits into
frappe:developfrom
20vikash:agent-job-cleanup
Open

feat(agent): Add job cleanup playbook task in update_agent#6554
20vikash wants to merge 3 commits into
frappe:developfrom
20vikash:agent-job-cleanup

Conversation

@20vikash
Copy link
Copy Markdown
Contributor

Description
This calls Agent's agent-db-cleanup cli to setup DB cleanup crontab.

Related PR
Agent

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 29, 2026

Greptile Summary

Adds a single Ansible task to the update_agent playbook that calls agent setup agent-db-cleanup to register a DB cleanup crontab entry on the agent host.

  • The new task is correctly placed after the agent update step, so the new CLI subcommand is guaranteed to be present before it runs.
  • Task follows the same become: yes / become_user: frappe / command / chdir pattern as all surrounding tasks, including the analogous agent setup database step.

Confidence Score: 5/5

Minimal, well-scoped change that adds one idempotent-safe CLI call in the correct position within the update sequence.

The change is a single task addition that runs an agent CLI command as the frappe user, placed after the agent binary is updated and before supervisor restart. No logic, permissions, or data paths are affected beyond registering a crontab entry.

No files require special attention.

Important Files Changed

Filename Overview
press/playbooks/roles/update_agent/tasks/main.yml Adds a new Ansible task to run agent setup agent-db-cleanup after the agent update step, following the same pattern as existing setup tasks in the playbook.

Sequence Diagram

sequenceDiagram
    participant Ansible
    participant Agent as Agent (frappe user)
    participant Cron as Crontab

    Ansible->>Agent: git fetch + checkout + reset
    Ansible->>Agent: pip install requirements
    Ansible->>Agent: pip install -e (install agent)
    Ansible->>Agent: agent setup database
    Ansible->>Agent: agent run-patches
    Ansible->>Agent: agent update
    Ansible->>Agent: agent setup agent-db-cleanup
    Agent->>Cron: register DB cleanup crontab entry
    Ansible->>Agent: set ownership of logs
    Ansible->>Agent: ensure supervisor processes started
Loading

Reviews (6): Last reviewed commit: "fix(agent): Move cleanup task after agen..." | Re-trigger Greptile

@20vikash 20vikash force-pushed the agent-job-cleanup branch from b4f149c to a1331f5 Compare May 29, 2026 08:16
@ssiyad
Copy link
Copy Markdown
Member

ssiyad commented Jun 4, 2026

@greptileai re-review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants